#ifndef GAME_H_INCLUDED
#define GAME_H_INCLUDED

#include "Singleton.h"
#include "GameState.h"
#include "CollisionSystem.h"
#include "GameObject.h"
#include "AiAgent.h"


#include <vector>


//#include "BulletDebug.h"

typedef void (*CollisionHandler) (GameObject* go1,GameObject* go2);
class Game : public Uncopyable
{
private:
	typedef std::pair<std::string, std::string> Key_Type;

	typedef std::map<Key_Type, CollisionHandler> CollisionMap;
	Game();
	friend class Singleton<Game>;
public:
	~Game();
	void Start();

	void Draw();
	void Update();
	void SetGameState(GameState* theGameState);
	void LoadSettings(std::string Filename);
	void SaveSettings();

	GameObject* GetObject(int ID);
	void SetCollisionSystem(CollisionSystem* pCs);
	void UpdateCollisions();
	void DrawGameObjects();
	void UpdategameObjects();
	void AddGameObject(int id, GameObject* g);
	void HandleCollision(GameObject* go1,GameObject* go2);
	bool AddCollisionHandler(const std::string& s1,const std::string& s2, CollisionHandler);

	//Return Functions

	int& ReturnResolutionX()
	{
		return m_ResolutionX;
	}
	
	int& ReturnResolutionY()
	{
		return m_ResolutionY;
	}

	bool& ReturnFullScreenValue()
	{
		return m_FullScreen;
	}

private:
	GameState* m_State;
	GameObjectsMap m_objects;
	CollisionSystem* m_pCollisionSystem;

	//Setting Variables
	int m_ResolutionX;
	int m_ResolutionY;
	bool m_FullScreen;

	CollisionMap m_CollisionMap;
};

typedef Singleton<Game> TheGame;

#endif